<template>
	<view name='user'>
		<view class="flex-col">
			<view class="flex-col section_1">
				<text class="text">个人中心</text>
				<view class="justify-between group_1">
					<view class="flex-row" style="width:70vw;">
						<image :src="info.avatar" class="image" />
						<!-- <image
              :src="avatar"
              class="image"
            /> -->
						<view class="flex-col group_3">
							<view class="flex-row">
								<!-- <text class="text_1">{{nikeName}}</text> -->
								<text class="text_1">{{info.nikeName}}</text>
							</view>
							<!-- <text class="text_2" v-if="!vip">当前身份：普通用户</text>
              <text class="text_2" v-else>当前身份：{{yesnovip}}</text> -->
							<text class="text_2">会员等级：{{info.vipName}}</text>
						</view>
					</view>
					<view class="flex-col items-center section_2" @click="qiehuan">
						<view class="flex-col items-center text-wrapper"><text class="text_3">切换身份</text></view>
					</view>
					<!--  <view class="signIn">
              <image src="../../static/uservip.png" style=""></image>签到
          </view> -->
				</view>
				<view class="" style="display: flex;justify-content: flex-end;">

				</view>

				<view class="flex-col group_5">
					<view class="flex-col section_3">
						<view class="justify-between group_6">
							<text class="text_4">我的订单</text>
							<view class="flex-row group_7" @click="onClickImage_12(4)">
								<text class="text_5">查看全部</text>
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558021231875960732.png"
									class="image_2" />
							</view>
						</view>
						<view class="flex-row equal-division">
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(0)">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827834097120.png"
									class="image_3" />
								<text class="text_6">待付款</text>
							</view>
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(1)">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846352123013.png"
									class="image_3" />
								<text class="text_6">待咨询</text>
							</view>

              <view class="flex-col items-center equal-division-item" @click="onClickImage_12(2)">
                <image
                    src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827846739612.png"
                    class="image_3" />
                <text class="text_6">待评价</text>
              </view>
							<view class="flex-col items-center equal-division-item" @click="onClickImage_12(3)">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827842139269.png"
									class="image_3" />
								<text class="text_6">已完成</text>
							</view>

						</view>
					</view>
					<view class="flex-col section_4">
						<text class="text_12">常用功能</text>
						<view class="flex-row equal-division_1">
							<view class="flex-col items-center equal-division-item_1" @click="distribution()">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827857765829.png"
									class="image_3" />
								<text class="text_13">推广分销</text>
							</view>
              <view class="flex-col items-center equal-division-item_1" @click="ExpertsLn">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846366662569.png"
									class="image_3" />
								<text class="text_13">咨询师入驻</text>
							</view>
<!--              <button class="flex-col equal-division-item_1" open-type="contact"
                      style="align-items: center;margin-left: 40rpx; margin-right: 0rpx">
                <image
                    src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827851285410.png"
                    class="image_3" />
                <text class="text_13">联系客服</text>
              </button>-->
              <view class="flex-col items-center equal-division-item_1" @click="discountCoupon">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846355448958.png"
									class="image_3" />
								<text class="text_13">我的优惠券</text>
							</view>
							<view class="flex-col items-center equal-division-item_1 group_13" @click="wallet">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827854048906.png"
									class="image_3" />
								<text class="text_13">我的钱包</text>
							</view>
							<!-- <view class="flex-col items-center equal-division-item_1 group_13" @click="onClickView_32">
                <image
                  src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827847314936.png"
                  class="image_3"
                  @click="onClickImage_17"
                />
                <text class="text_13">我的收藏</text>
              </view>
              <view class="flex-col items-center equal-division-item_1" @click="onClickImage_18">
                <image
                  src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827844186239.png"
                  class="image_3"
                />
                <text class="text_13">我的问答</text>
              </view> -->



						</view>
						<view class="flex-row equal-division_1">

							<button class="flex-col equal-division-item_1" open-type="contact"
								style="align-items: center;margin-left: 40rpx;">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028827851285410.png"
									class="image_3" />
								<text class="text_13">联系客服</text>
							</button>

							<!-- <view class="flex-col items-center equal-division-item_1" @click="onClickImage_366">
                <image
                  src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558100870348078938.png"
                  class="image_3"
                />
                <text class="text_13">我的卡包</text>
              </view> -->

						</view>

					</view>
					<view class="flex-col section_5">
						<text class="text_21">其他功能</text>
						<view class="flex-row equal-division_2">
							<view class="flex-col items-center equal-division-item_2 group_19" @click="help">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846362401998.png"
									class="image_3"/>
								<text class="text_22">帮助中心</text>
							</view>
							<view class="flex-col items-center equal-division-item_2" @click="news">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846367496538.png"
									class="image_3" />
								<text class="text_22">消息中心</text>
							</view>

							<view class="flex-col items-center equal-division-item_2" @click="opinion">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846377063333.png"
									class="image_3"/>
								<text class="text_22">意见反馈</text>
							</view>
							<view class="flex-col items-center equal-division-item_2" @click="we">
								<image
									src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028846372383675.png"
									class="image_3" />
								<text class="text_22">关于我们</text>
							</view>
						</view>
					</view>
					<!-- <view class="justify-center section_6" v-show="show">
            <image
              src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62ac1d455a7e3f03100b6468/62b188edd029820011534ee0/16558028802560178888.png"
              class="image_20"
              @click="show=false"
            />
            <text class="text_27">加入咨询福利群，超多内部福利不错过~</text>
            <view class="flex-col items-center text-wrapper_1"><text class="text_28" @click = "scanqr()">去扫码</text></view>
          </view> -->
					<!-- <view class="" style="text-align: center;margin-top: 30rpx;" @click="space(PersonalAdvertisingSpace.url)">
                <image :src="PersonalAdvertisingSpace.pic" mode="" style="width: 92vw;height: 260rpx;"></image>
          </view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getPersonalAdvertisingSpace,
		getselect,
		getconfirm
	} from '../../api/index.js'
	export default {

		name: 'user',
		props: {
			cur: String,
		},
		components: {},
		data() {
			return {
				value1: 1,
				PersonalAdvertisingSpace: '',
				nikeName: '',
				avatar: '',
				show: true,
				vip: '',
				yesnovip: '',
				info: {}

			};
		},

		created() {
			let that = this
			this.info = this.$store.state.userInfo.wxInfo
			// if (this.$store.state.userInfo.wxInfo.ifexperts) {
			//   this.avatar='http://152.136.15.132:9000/'+this.$store.state.userInfo.wxInfo.avatar
			// } else {
			//   this.avatar=this.$store.state.userInfo.wxInfo.avatar
			// }
			//  this.nikeName=this.$store.state.userInfo.wxInfo.nikeName
		},
		methods: {
			// scanqr(){
			// let url='https://mp.weixin.qq.com/s?__biz=MzkzMjM4MzkzOA==&mid=2247483657&idx=1&sn=eb8a85a37fd6d4535ea363fc26e0453d&chksm=c25ddca4f52a55b2f0e91afdae5f43c8583fee8f54b1b274e91da8411589ffa64a6597e41900#rd'
			// console.log(url);
			//   uni.navigateTo({
			//       url:`../course/course?id=${encodeURIComponent(url)}&title=文杰餐饮圈`,
			//   })
			// },
			// space(url){
			//     uni.navigateTo({
			//          url:`../course/course?id=${encodeURIComponent(url)}&title=文杰餐饮圈`,
			//     })
			// },
			qiehuan() {
                    let that = this
                if (this.info.userType == "2") {
                	let that = this
                	uni.showModal({
                		content: '确定要更换身份吗？',
                		success: function(res) {
                			if (res.confirm) {
                				console.log('用户点击确定');
                				that.$emit('resurl', that.value1);
                			} else if (res.cancel) {
                				console.log('用户点击取消');
                			}
                		}
                	})
                } else {
                	uni.showModal({
                		content: '抱歉您还没有其他身份',
                		success: function(res) {
                			if (res.confirm) {
                				console.log('用户点击确定');
                				// that.$emit('resurl',that.value1);
                			} else if (res.cancel) {
                				console.log('用户点击取消');
                			}
                		}
                	})
                }
				// if (this.info.userType == "2") {
				// 	let that = this
				// 	uni.showModal({
				// 		content: '确定要更换身份吗？',
				// 		success: function(res) {
				// 			if (res.confirm) {
				// 				console.log('用户点击确定');
				// 				that.$emit('resurl', that.value1);
				// 			} else if (res.cancel) {
				// 				console.log('用户点击取消');
				// 			}
				// 		}
				// 	})
				// } else {
				// 	uni.showModal({
				// 		content: '抱歉您还没有其他身份',
				// 		success: function(res) {
				// 			if (res.confirm) {
				// 				console.log('用户点击确定');
				// 				// that.$emit('resurl',that.value1);
				// 			} else if (res.cancel) {
				// 				console.log('用户点击取消');
				// 			}
				// 		}
				// 	})
				// }

				// getselect().then(res=>{
				//     if(res.data){

				//       }
				//     else{
				//       uni.showModal({
				//           content: '抱歉您还没有其他身份',
				//           success: function (res) {
				//               if (res.confirm) {
				//                   console.log('用户点击确定');
				//                   // that.$emit('resurl',that.value1);
				//               } else if (res.cancel) {
				//                   console.log('用户点击取消');
				//               }
				//           }
				//       })
				//     }
				// })
			},
            news(){
                uni.navigateTo({
                    url:'/pages/User/news'
                })
            },
			onClickImage_12(a) {
				console.log(a)
        let data = {
          orderStatus: a
        }
				uni.navigateTo({
					url: '/pages/myorder/myorder?data=' + encodeURIComponent(JSON.stringify(data)),
				});
			},
			distribution() {
				//分销
				uni.navigateTo({
					url: '/pages/distribution/distribution'
				})
			},
            discountCoupon(){
               uni.navigateTo({
                   url:'/pages/User/discountCoupon'
               })
            },
            wallet(){
                uni.navigateTo({
                    url:'/pages/User/wallet'
                })

            },
            help(){
                uni.navigateTo({
                    url:'/pages/User/help'
                })
            },
            we(){
                uni.navigateTo({
                    url:'/pages/User/we'
                })
            },
            opinion(){
               uni.navigateTo({
                   url:'/pages/User/opinion'
               })
            },
            phone(){
                uni.navigateTo({
                    url:'/pages/User/phone'
                })
            },
			ExpertsLn() {
				if( this.$store.state.userInfo.wxInfo.userType == "2"){
					uni.showToast({
						title: '你已是咨询师',
						icon: 'none'
					})
					return
				}
                uni.navigateTo({
                	url: '/pages/User/ExpertsLn'
                });
				// let that = this
				// getselect().then(ress => {
				// 	if (ress.data) {
				// 		uni.showModal({
				// 			title: '提示',
				// 			content: '您是否要重新申请咨询师身份',
				// 			success: function(res) {
				// 				if (res.confirm) {
				// 					console.log('用户点击确定');
				// 					let data = {
				// 						expertsId: this.$store.state.userInfo.wxInfo.uid
				// 					}
				// 					getconfirm(data).then(resz => {
				// 						console.log("确认修改咨询师", resz);
				// 					})
				// 					uni.navigateTo({
				// 						url: '/pages/huaban_1_kaobei_73/huaban_1_kaobei_73?token=' +
				// 							that.token
				// 					});
				// 				} else if (res.cancel) {
				// 					console.log('用户点击取消');
				// 				}
				// 			}
				// 		})
				// 	} else {
				// 		uni.navigateTo({
				// 			url: '/pages/huaban_1_kaobei_73/huaban_1_kaobei_73?token=' + that.token
				// 		});
				// 	}
				// })

			},

		},
	};
</script>

<style scoped lang="css">
	button::after {
		border: none;
	}

	button {
		background-color: #fff;
	}

	.image_21 {
		width: 1.69rem;
		height: 1.69rem;
	}

	.equal-division-item {
		flex: 1 1 4.31rem;
		padding: 0.33rem 0;
	}

	.equal-division-item_1 {
		margin-left: 0.2rem;
		padding: 0.36rem 0 0.31rem;
	}

	.equal-division-item_2 {
		margin-left: 0.16rem;
		flex: 1 1 5.28rem;
		padding: 0.3rem 0 0.31rem;
	}

	.image_3 {
		width: 1.5rem;
		height: 1.5rem;
	}

	.text_6 {
		margin-top: 0.58rem;
		color: #333333;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.72rem;
	}

	.text_13 {
		margin-top: 0.52rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_22 {
		margin-top: 0.3rem;
		color: #2f356f;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.page {
		background-color: #ffffff;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100%;
	}

	.tab-bar {
		padding: 0.19rem 1.97rem 0.44rem 2.03rem;
		background-color: #ffffff;
	}

	.section_1 {
		margin-top: -3.09rem;
		padding: 5.13rem 0.41rem 10rpx 0.91rem;
		background-image: linear-gradient(#4B9BDB, #F4F5F9, #F4F5F9);
		background-size: 100% 100%;
		background-repeat: no-repeat;
		position: relative;
	}

	.group_23 {
		height: 2.47rem;
	}

	.group_24 {
		height: 2.41rem;
	}

	.group_25 {
		height: 2.44rem;
	}

	.group_26 {
		height: 2.42rem;
	}

	.group_27 {
		margin-top: 0.094rem;
		height: 2.38rem;
	}

	.text {
		align-self: center;
		color: #000;
		font-size: 1.06rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 1rem;
	}

	.group_1 {
		margin-top: 2.13rem;
		align-items: center;
		margin-bottom: 2.13rem;
	}

	.signIn {
		width: 27rpx;
		height: 27rpx;
	}

	.text_29 {
		margin-top: 0.19rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_30 {
		margin-top: 0.13rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_31 {
		margin-top: 0.16rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_32 {
		margin-top: 0.14rem;
		color: #9dabc0;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.text_33 {
		margin-top: 0.094rem;
		color: #6d79fe;
		font-size: 0.63rem;
		font-family: SourceHanSansCN;
		line-height: 0.59rem;
	}

	.section_2 {
		padding: 0.19rem 0 0.75rem;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		width: 5.47rem;
		height: 2.69rem;
	}

	.section_3 {
		margin-right: 0.53rem;
		padding: 1rem 0 0.78rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
	}

	.section_4 {
		margin-right: 0.47rem;
		margin-top: 1rem;
		padding: 0.91rem 0 1.16rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
	}

	.section_5 {
		margin-right: 0.53rem;
		margin-top: 0.94rem;
		padding: 0.94rem 0 0.72rem;
		background-color: #ffffff;
		border-radius: 0.47rem;
	}

	.section_6 {
		margin-right: 0.56rem;
		margin-top: 0.97rem;
		padding: 0.66rem 0 0.59rem;
		background-color: #fff0e3;
		border-radius: 0.47rem;
	}

	.image {
		width: 4.19rem;
		height: 4.19rem;
		border-radius: 200rpx;
	}

	.group_3 {
		margin-left: 0.69rem;
		align-self: center;
	}

	.text-wrapper {
		padding: 0.53rem 0 0.5rem;
		background-color: #fff;
		box-shadow: inset 0px 0.031rem 0.094rem #71b8d8;
		border-radius: 0.88rem;
		width: 4.69rem;
	}

	.group_6 {
		padding: 0 0.94rem;
	}

	.equal-division {
		margin-top: 0.91rem;
	}

	.text_12 {
		margin-left: 0.97rem;
		align-self: flex-start;
		color: #333333;
		font-size: 1rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.94rem;
	}

	.equal-division_1 {
		margin-top: 0.91rem;
		padding: 0 0.31rem;
		justify-content: space-around;
	}

	.group_17 {
		margin-top: 0.94rem;
		padding: 0 2.22rem;
	}

	.group_18 {
		margin-top: 0.59rem;
		padding: 0 1.59rem;
	}

	.text_21 {
		margin-left: 0.91rem;
		align-self: flex-start;
		color: #333333;
		font-size: 1rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.97rem;
	}

	.equal-division_2 {
		margin-top: 0.91rem;
		padding: 0 0.23rem;
	}

	.image_20 {
		align-self: center;
		width: 0.69rem;
		height: 0.69rem;
	}

	.text_27 {
		margin-left: 0.94rem;
		align-self: center;
		color: #c4a78a;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.75rem;
	}

	.text-wrapper_1 {
		margin-left: 0.91rem;
		padding: 0.41rem 0 0.38rem;
		border-radius: 0.78rem;
		width: 3.63rem;
		height: 1.56rem;
		border: solid 0.063rem #fea14a;
	}

	.text_2 {
		margin-top: 0.91rem;
		color: #666666;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.72rem;
	}

	.text_3 {
		color: #4396D8;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.72rem;
	}

	.text_4 {
		color: #333333;
		font-size: 0.94rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 0.91rem;
	}

	.group_7 {
		margin-bottom: 0.16rem;
	}

	.group_13 {
		margin-left: 0;
	}

	.image_13 {
		margin-top: 0.094rem;
		width: 1.41rem;
		height: 1.31rem;
	}

	.image_14 {
		margin-left: 3.81rem;
		width: 1.41rem;
		height: 1.44rem;
	}

	.image_15 {
		margin-left: 3.97rem;
		width: 1.41rem;
		height: 1.41rem;
	}

	.text_18 {
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_19 {
		margin-left: 2.44rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.69rem;
	}

	.text_20 {
		margin-left: 2.53rem;
		color: #333333;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.group_19 {
		margin-left: 0;
	}

	.text_28 {
		color: #fea14a;
		font-size: 0.69rem;
		font-family: SourceHanSansCN;
		line-height: 0.66rem;
	}

	.text_1 {
		color: #333333;
		font-size: 1.06rem;
		font-family: SourceHanSansCN;
		font-weight: 500;
		line-height: 1.3rem;
		display: inline-block;
		width: 40vw;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;

	}

	.image_1 {
		margin-right: 3.06rem;
		width: 0.88rem;
		height: 0.88rem;
	}

	.text_5 {
		color: #666666;
		font-size: 0.75rem;
		font-family: SourceHanSansCN;
		line-height: 0.75rem;
	}

	.image_2 {
		margin: 0.13rem 0 0.094rem 0.28rem;
		flex-shrink: 0;
		width: 0.28rem;
		height: 0.53rem;
	}
</style>
